<template>
    <div class="elResetBody" v-if="drawer">
        <el-drawer v-model="drawer" direction="rtl" :show-close="false" :size="600" @close="closeCallBack">
            <template #header>
                <div class="header-title">
                    <span>{{ nodeData.typeName }}</span>
                    <span style="font-size: 13px;">{{ nodeData.id }}</span>
                </div>
            </template>
            <template #default>
                <!-- 节点配置 -->
                <div v-if="nodeData.type==='userTask'">
                    <div class="system-set">
                        <div>
                            <span class="hdTitle">代码</span>
                            <el-input v-model="nodeData.code" style="width: 240px" :disabled="props.isRead"/>
                        </div>
                        <div style="margin-left: 60px;">
                            <span class="hdTitle">名称</span>
                            <el-input v-model="nodeData.name" style="width: 240px" :disabled="props.isRead"/>
                        </div>
                    </div>
                    <div>
                        <el-tabs v-model="activeName" class="demo-tabs">
                            <el-tab-pane label="属性" name="first">
                                <Attribute :isRead="props.isRead"/>
                            </el-tab-pane>
                            <el-tab-pane label="执行动作" name="second">
                                <AttributeConfig :isRead="props.isRead"/>
                            </el-tab-pane>
                            <el-tab-pane label="审核人" name="third">
                                <AuditorConfig ref="auditorConfigRef" :isRead="props.isRead"/>
                            </el-tab-pane>
                            <!-- <el-tab-pane label="启动校验" name="fourth">
                                <CheckConfig ref="checkConfigRef" :isRead="props.isRead"/>
                            </el-tab-pane>                          -->
                        </el-tabs>
                    </div>                    
                </div>
                <!-- 线段配置 -->
                <div style="height: 100%;" v-else-if="nodeData.type=== 'custom-edge'">
                    <edgeConfig ref="edgeCheckRef" :isRead="props.isRead" :startNodeActions="startNodeActions"/>
                </div>
            </template>
            <template #footer>
                <div style="flex: auto">
                    <el-button @click="cancelClick">{{props.isRead?'关闭':'取消'}}</el-button>
                    <el-button type="primary" @click="confirmClick" v-if="!props.isRead">确认</el-button>
                </div>
            </template>
        </el-drawer>
    </div>
</template>

<script setup lang="ts">
import Attribute from './attribute.vue';
import AttributeConfig from './attributeConfig.vue';
import AuditorConfig from './auditorConfig.vue';
// import CheckConfig from './checkConfig.vue';
import edgeConfig from './edgeConfig.vue';
import { v4 as uuidv4 } from 'uuid';

const props = defineProps({
    isRead: {
        type: Boolean,
        default: false,
    },
})
const flowResource = inject('flowResource',ref());
const flowDefBusinessData = inject('flowDefBusinessData',ref());

// 初始化属性数据
const attributeObj = ref();
provide('attributeObj',attributeObj)

const initAttributeObj = () => {
    // 直接从响应式对象获取当前值
    let defaultCheckList = [{
            value:  'isShowAllRiskReason',
            label: '是否展示所有风控原因',
        },{
            value:  'isAllowEditOpinion',
            label: '是否允许编辑审批意见',
        },{
            value:  'isAllowUploadOpinionFile',
            label: '是否允许上传审批附件',
        },{
            value:  'isAllowDelegate',
            label: '是否允许流程委托',
        },{
            value:  'isAllowFlowCenterAudit',
            label: '是否允许流程中心审批',
        },{
            value:  'isAllowFlowBatchAudit',
            label: '是否允许批量流程审批',
        },
    ];
    let checkedDefaultCheckList: any[] = []; //默认选中同意、退回
    // 直接使用当前值
    if(nodeData.value.businessData.prop){
        defaultCheckList.forEach((item: any) => {
            if(nodeData.value.businessData.prop[item.value]){
                checkedDefaultCheckList.push(item.value);
            }
        }) 
    }
    attributeObj.value = { defaultCheckList, checkedDefaultCheckList }
};
//初始化AttributeConfig数据
const attributeConfigObj = ref();
provide('attributeConfigObj',attributeConfigObj);
export interface ActionItemType {
    id: string;
    label: string;
    value: string;
    isEdit: boolean;
    isEdgeAction: boolean;
    startCheck?: any; // 新增
    secondConfirm?: any; // 新增
}
const initAttributeConfig = () => {
    let defaultCheckList: ActionItemType[] = [
        {
            id: 'agree',
            label: '同意',
            value: 'agree',
            isEdit: false,
            isEdgeAction: false,
            startCheck: null,
            secondConfirm: null
        },
        {
            id: 'reject',
            label: '退回',
            value: 'reject',
            isEdit: false,
            isEdgeAction: false,
            startCheck: null,
            secondConfirm: null
        },
        {
            id: 'submit',
            label: '提交',
            value: 'submit',
            isEdit: false,
            isEdgeAction: false,
            startCheck: null,
            secondConfirm: null
        },
        {
            id: 'save',
            label: '保存',
            value: 'save',
            isEdit: false,
            isEdgeAction: true,
            startCheck: null,
            secondConfirm: null
        },
        {
            id: 'revert',
            label: '撤回',
            value: 'revert',
            isEdit: false,
            isEdgeAction: false,
            startCheck: null,
            secondConfirm: null
        },
        {
            id: 'terminate',
            label: '终止',
            value: 'terminate',
            isEdit: false,
            isEdgeAction: true,
            startCheck: null,
            secondConfirm: null
        },
    ];
    let checkedDefaultCheckList = ['agree', 'reject']; //默认选中同意、退回
    if(nodeData.value.businessData.actions && nodeData.value.businessData.actions.length > 0){
        const excludedActions = ['agree', 'reject', 'submit','save', 'revert', 'terminate'];
        checkedDefaultCheckList = []
        // console.log('编辑动作1：',nodeData.value.businessData.actions)
        nodeData.value.businessData.actions.forEach((action: any) => {   
            if (!excludedActions.includes(action.actionCode)) {
                // 不存在的节点赋值
                const uniqueId = uuidv4(); // 生成唯一标识符                
                defaultCheckList.push({
                    id: `custom-${uniqueId}`,
                    label: action.actionName?action.actionName:'',
                    value: action.actionCode?action.actionCode:'',
                    isEdit: true,
                    isEdgeAction: action.isCurrNodeAction==1? true : false,
                    startCheck: action.startCheck ? action.startCheck : null,
                    secondConfirm: action.secondConfirm ? action.secondConfirm : null,
                });               
            }else{
                // 已存在的节点赋值
                defaultCheckList.forEach((item: any) => { 
                    if(item.value === action.actionCode){
                        item.label = action.actionName?action.actionName:'';
                        item.isEdit = false;
                        item.isEdgeAction = action.isCurrNodeAction==1? true : false;
                        item.startCheck = action.startCheck;
                        item.secondConfirm = action.secondConfirm;
                    }
                });     
            }
            const foundItem = defaultCheckList.find((item:any) => item.value === action.actionCode);
            if(foundItem){
                checkedDefaultCheckList.push(foundItem.id)
            }
        });         
    }
    attributeConfigObj.value = {
        defaultCheckList: defaultCheckList,
        checkedDefaultCheckList: checkedDefaultCheckList,        
    }    
    // console.log('编辑动作2：',attributeConfigObj.value)
};
// 定义组件的属性
export interface NodeDataType {
    id: string | null;
    type: string | null;
    typeName: string | null;
    position:{x:number,y:number};
    code?: string | null;
    name?: string | null;
    associatedId?:string;
    direction?: string;
    businessData?:any;
}
const drawer = ref<boolean>(false)
const titleColor = ref<string>('#fff')
const nodeData = ref<NodeDataType>({
    id: null,
    type: null,
    typeName: null,
    code: null,
    name: null,
    position:{x:0 , y:0},    
})
provide('nodeData', nodeData)

const activeName = ref('first');
const $emit = defineEmits(['confirmNode','closeNode'])
function closeCallBack() {    
    $emit('closeNode', nodeData.value.id)
}
function cancelClick() {    
    drawer.value = false
}
//有效性校验函数
const validData = (dataList:any[]) => {    
    const dataSet = new Set(); // 用于检测重复的actionCode值
    for (const data of dataList){
        // 检查 actionCode 和 actionName 是否为空
        if (!data.actionCode || !data.actionName) {
            ElMessage.error('名称或代码不能为空（执行动作）');
            return false;
        }
        // 检查 actionCode 是否重复
        if (dataSet.has(data.actionCode)) { 
            ElMessage.error('代码不能重复执行动作');           
            return false;
        }
        dataSet.add(data.actionCode);
    }    
    return true;
}
const auditorConfigRef = ref<any>(null);
const edgeCheckRef = ref<any>(null);
const toMyStr = (val: any)=> {
    if (!val ||( Array.isArray(val) && val.length === 0)) {
        return null;
    }else{
        return val;
    }
}
const checkConfigRef = ref<any>(null);
const confirmClick = ()=> {
    if(nodeData.value.type=='userTask'){
        if(!nodeData.value.code){
            ElMessage.error('节点代码不能为空');           
            return
        }
        if(!nodeData.value.name){
            ElMessage.error('节点名称不能为空');           
            return
        }
        // 处理属性保存
        if(attributeObj.value.defaultCheckList.length>0){
            nodeData.value.businessData.prop = {}
            // console.log('属性保存：',attributeObj.value.checkedDefaultCheckList);
            attributeObj.value.defaultCheckList.forEach((item: any) => {
                if(attributeObj.value.checkedDefaultCheckList.includes(item.value)){
                    nodeData.value.businessData.prop[item.value] = 1;
                }else{
                    nodeData.value.businessData.prop[item.value] = 0;
                }
            })
        }
        //处理action
        // console.log('确认保存1 :',attributeConfigObj.value.defaultCheckList)
        if(attributeConfigObj.value.defaultCheckList.length>0){
            nodeData.value.businessData.actions.length = 0
            attributeConfigObj.value.defaultCheckList.forEach((action: any) => {
                if(attributeConfigObj.value.checkedDefaultCheckList.includes(action.id)){
                    nodeData.value.businessData.actions.push({
                        actionCode: action.value,
                        actionName: action.label,
                        isCurrNodeAction: action.isEdgeAction?1:0,
                        startCheck: action.startCheck,
                        secondConfirm: action.secondConfirm,
                    })
                }
            })
        }
        //处理businessData数据 
        if(auditorConfigRef.value){
            auditorConfigRef.value.doSave();
            // 数据保存后，非空校验
            auditorConfigRef.value.doCheck();
            // 1.如果选择了指定部门,未勾选独立部门; 2.如果勾选了部门,内容没有完善, 则不允许通过
            if((auditorConfigRef.value.itemData.isDirectAudit && auditorConfigRef.value.allNotChecked) || !auditorConfigRef.value.isInfoPass){
                return
            }
        }
        if(checkConfigRef.value){
            checkConfigRef.value.doSave();
            // 数据保存后，非空校验
            checkConfigRef.value.doCheck();
            if((checkConfigRef.value.itemData.isDirectCheck && checkConfigRef.value.allNotChecked) || !checkConfigRef.value.isInfoPass){
                return
            }
        }
        const nodeToUpdate = flowDefBusinessData.value.nodes.find((node:any) => node.id === nodeData.value.id);
        if (nodeToUpdate) {
            //判断data.businessData.actions的actionCode和actionName不能为空，且actionCode不能重复
            const isValid = validData(nodeData.value.businessData.actions);
            if(isValid){
                // 更新 nodeToUpdate 的 actions 属性
                nodeToUpdate.actions = nodeData.value.businessData.actions;
            }else{
                return;
            }
            nodeToUpdate.prop = nodeData.value.businessData.prop; 
            // 更新 nodeToUpdate 的 isCommonAudit 和 commonAudit 属性
            nodeToUpdate.isCommonAudit = auditorConfigRef.value.itemData.isCommonAudit?'1':'0';
            nodeToUpdate.commonAudit = {
                dictDeptCfgCategory: 0, // 必传
                dictSpeAuditType: auditorConfigRef.value.itemData.commonAudit.dictSpeAuditType,
                dictSpeAuditor: auditorConfigRef.value.itemData.commonAudit.dictSpeAuditor,
                candidate: toMyStr(auditorConfigRef.value.itemData.commonAudit.candidate),
                formColumn: auditorConfigRef.value.itemData.commonAudit.formColumn,
                directUserCode: auditorConfigRef.value.itemData.commonAudit.directUserCode,
                className:  auditorConfigRef.value.itemData.commonAudit.className,
                isAllowAddCountersign: auditorConfigRef.value.itemData.commonAudit.isAllowAddCountersign,
            };
            nodeToUpdate.isDirectAudit = auditorConfigRef.value.itemData.isDirectAudit?'1':'0';
            nodeToUpdate.directAudits =  auditorConfigRef.value.itemData.directAudits;
            // 启动校验
            if(checkConfigRef.value){
                nodeToUpdate.isCommonCheck = checkConfigRef.value.itemData.isCommonCheck?'1':'0';
                nodeToUpdate.commonCheck = {
                    dictDeptCfgCategory: 0, // 必传
                    dictSpeCheckType: checkConfigRef.value.itemData.commonCheck.dictSpeCheckType,
                    forRiskBusinessId: checkConfigRef.value.itemData.commonCheck.forRiskBusinessId,
                    riskBusinessName: checkConfigRef.value.itemData.commonCheck.riskBusinessName,
                    className:  checkConfigRef.value.itemData.commonCheck.className,
                };
                nodeToUpdate.isDirectCheck = checkConfigRef.value.itemData.isDirectCheck?'1':'0';
                nodeToUpdate.directChecks =  checkConfigRef.value.itemData.directChecks;
            }
        }else{
            flowDefBusinessData.value.nodes.push({
                id: nodeData.value.id,
                prop: nodeData.value.businessData.prop,
                actions: nodeData.value.businessData.actions,
                // 审核人
                isCommonAudit: nodeData.value.businessData.isCommonAudit?'1':'0',
                commonAudit:{
                    dictDeptCfgCategory: 0, // 必传
                    dictSpeAuditType: nodeData.value.businessData.commonAudit.dictSpeAuditType,
                    dictSpeAuditor: nodeData.value.businessData.commonAudit.dictSpeAuditor,
                    candidate: toMyStr(nodeData.value.businessData.commonAudit.candidate),
                    formColumn: nodeData.value.businessData.commonAudit.formColumn,
                    directUserCode: nodeData.value.businessData.commonAudit.directUserCode,
                    className:  nodeData.value.businessData.commonAudit.className,
                    isAllowAddCountersign: nodeData.value.businessData.commonAudit.isAllowAddCountersign,
                },
                isDirectAudit: nodeData.value.businessData.isDirectAudit?'1':'0',
                directAudits: nodeData.value.businessData.directAudits,
                // 启动校验
                isCommonCheck: nodeData.value.businessData.isCommonCheck?'1':'0',
                commonCheck:{
                    dictDeptCfgCategory: 0, // 必传
                    dictSpeCheckType: nodeData.value.businessData.commonCheck.dictSpeCheckType,
                    forRiskBusinessId: nodeData.value.businessData.commonCheck.forRiskBusinessId,
                    riskBusinessName: nodeData.value.businessData.commonCheck.riskBusinessName,
                    className:  nodeData.value.businessData.commonCheck.className,
                },
                isDirectCheck: nodeData.value.businessData.isDirectCheck?'1':'0',
                directChecks: nodeData.value.businessData.directChecks
            });
        }
    } else if(nodeData.value.type === 'custom-edge'){
        if(!nodeData.value.businessData.prop.priority){
            ElMessage.error('优先级不能为空');           
            return
        }
        if(edgeCheckRef.value){
            edgeCheckRef.value.doSave();
            // 数据保存后，非空校验
            edgeCheckRef.value.doCheck();
            if((nodeData.value.businessData.isDirectCheck && edgeCheckRef.value.allNotChecked) || !edgeCheckRef.value.isInfoPass){
                return
            }
        }
        // 检查参数映射中是否存在必填参数未填写的情况
        let risk = nodeData.value.businessData.turnAround.risk;
        if (risk && Array.isArray(risk)) {
            for (let i = 0; i < risk.length; i++) {
                const item = risk[i];
                if (item.params && Array.isArray(item.params)) {
                    const invalidParam = item.params.find((param: { isNotNull: number; columnPath: string; }) => param.isNotNull === 1 && param.columnPath === '');
                    if (invalidParam) {
                        ElMessage.error('风控项目参数映射中存在必填参数未填写');
                        return false;
                    }
                }
            }
        }

        const nodeToUpdate = flowDefBusinessData.value?.edges.find( (item:any) => item.id === nodeData.value.id);
        if (nodeToUpdate) {
            nodeToUpdate.prop = nodeData.value.businessData.prop;
            nodeToUpdate.turnAround = nodeData.value.businessData.turnAround; 
            // nodeToUpdate.isCommonTurn = nodeData.value.businessData.isCommonTurn?'1':'0';
            // nodeToUpdate.commonTurn = {
            //     dictDeptCfgCategory: 0, // 必传
            //     dictSpeCheckType: nodeData.value.businessData.commonTurn.dictSpeCheckType,
            //     forRiskBusinessId: nodeData.value.businessData.commonTurn.forRiskBusinessId,
            //     riskBusinessName: nodeData.value.businessData.commonTurn.riskBusinessName,
            //     className:  nodeData.value.businessData.commonTurn.className,
            // };
            // nodeToUpdate.isDirectTurn = nodeData.value.businessData.isDirectTurn?'1':'0';
            nodeToUpdate.turnAround =  nodeData.value.businessData.turnAround;
        }else{
            flowDefBusinessData.value.edges.push({
                id: nodeData.value.id,
                prop: nodeData.value.businessData.prop,
                turnAround: nodeData.value.businessData.turnAround,
                // isCommonTurn: nodeData.value.businessData.isCommonTurn?'1':'0',
                // commonTurn: {
                //     dictDeptCfgCategory: 0, // 必传
                //     dictSpeCheckType: nodeData.value.businessData.commonTurn.dictSpeCheckType,
                //     forRiskBusinessId: nodeData.value.businessData.commonTurn.forRiskBusinessId,
                //     riskBusinessName: nodeData.value.businessData.commonTurn.riskBusinessName,
                //     className:  nodeData.value.businessData.commonTurn.className,
                // },
                // isDirectTurn: nodeData.value.businessData.isDirectTurn?'1':'0',
                // directTurns: nodeData.value.businessData.directTurns
            });
        }
    }
    $emit('confirmNode', nodeData.value)    
    drawer.value = false 
}

export interface StartNodeActionType {
    actionName: string;
    actionCode: string;
    isCurrNodeAction: any;
    startCheck: any;
    secondConfirm: any;
}
// 线段可选的动作绑定列表
const startNodeActions = ref<StartNodeActionType[]>([]);
const editNode = (node: any) => {   
    
    if( node.type === 'userTask'){
        let nodeBusinessData:any;
        nodeBusinessData = flowDefBusinessData.value?.nodes.find( (item:any) => item.id === node.id);
        // console.log('节点业务信息：',nodeBusinessData);
        if(!nodeBusinessData){
            nodeBusinessData = {
                // 属性
                prop: {
                    isShowAllRiskReason: "",
                    isAllowEditOpinion: "",
                    isAllowUploadOpinionFile: "",
                    isAllowDelegate: "",
                    isAllowFlowCenterAudit: "",
                    isAllowFlowBatchAudit: ""
                },
                // 执行动作
                actions:[],
                // 审核人
                isCommonAudit:1,
                commonAudit:{
                    dictSpeAuditType:'1',
                    dictSpeAuditor:'3',
                    candidate: [],
                    formColumn: '',
                    directUserCode: [],
                    className: '',
                    isAllowAddCountersign: 1,
                },
                isDirectAudit: 0,
                directAudits:[],
                // 启动校验
                isCommonCheck: 0,
                commonCheck:{
                    dictSpeCheckType:'1',
                    forRiskBusinessId: null,
                    riskBusinessName: '',
                    className: '',
                },
                isDirectCheck: 0,
                directChecks:[],
            }
        }
        // console.log('节点prop：',node.properties)
        nodeData.value = {
            id: node.id,
            type: node.type,
            typeName: node.properties.customNodeTypeName,
            code: node.properties.customNodeCode,
            name: node.properties.customNodeName,
            position:{ x: node.x , y: node.y},
            associatedId: node.properties.associatedId,
            businessData: {
                prop: nodeBusinessData.prop ? nodeBusinessData.prop : {},
                actions: nodeBusinessData.actions?nodeBusinessData.actions:[
                    {   actionCode: "agree",
                        actionName: "同意",
                        isCurrNodeAction: 0,
                    },{   actionCode: "reject",
                        actionName: "退回",
                        isCurrNodeAction: 0
                    },
                ],
                // 审核人
                isCommonAudit: nodeBusinessData.isCommonAudit=='1'?true:false,
                commonAudit: nodeBusinessData.isCommonAudit?{
                    dictSpeAuditType: nodeBusinessData.commonAudit.dictSpeAuditType,
                    dictSpeAuditor: nodeBusinessData.commonAudit.dictSpeAuditor,
                    candidate: nodeBusinessData.commonAudit.candidate,
                    formColumn: nodeBusinessData.commonAudit.formColumn,
                    directUserCode: nodeBusinessData.commonAudit.directUserCode,
                    className: nodeBusinessData.commonAudit.className,
                    isAllowAddCountersign: nodeBusinessData.commonAudit.isAllowAddCountersign,
                }:{
                    dictSpeAuditType:'1',
                    dictSpeAuditor:'3',
                    candidate: [],
                    formColumn: '',
                    directUserCode: [],
                    className: '',
                    isAllowAddCountersign: 1
                },   
                isDirectAudit: nodeBusinessData.isDirectAudit=='1'?true:false,
                directAudits: nodeBusinessData.directAudits,     
                // 启动校验
                isCommonCheck: nodeBusinessData.isCommonCheck=='1'?true:false,
                commonCheck: nodeBusinessData.isCommonCheck?{
                    dictSpeCheckType: nodeBusinessData.commonCheck.dictSpeCheckType,
                    forRiskBusinessId: nodeBusinessData.commonCheck.forRiskBusinessId,
                    riskBusinessName: nodeBusinessData.commonCheck.riskBusinessName,
                    className: nodeBusinessData.commonCheck.className,
                }:{
                    dictSpeCheckType:'1',
                    forRiskBusinessId: null,
                    riskBusinessName: null,
                    className: '',
                },   
                isDirectCheck: nodeBusinessData.isDirectCheck=='1'?true:false,
                directChecks: nodeBusinessData.directChecks,  
            }
        };
        initAttributeObj();
        initAttributeConfig();
    }else if(node.type === 'custom-edge'){
        // console.log('边node：',node,nodeData.value);
        // console.log('hhh：', flowDefBusinessData.value);
        let startNodeId = node.sourceNodeId;
        let startNodeInfo = flowDefBusinessData.value?.nodes.find( (item:any) => item.id === startNodeId);
        if(!startNodeInfo){
            ElMessage.error('请完善线段起始节点属性！');
            return
        }
        startNodeActions.value = startNodeInfo.actions;
        // console.log('Actions：', startNodeActions.value);
        let edgeBusinessData: any;
        edgeBusinessData = flowDefBusinessData.value?.edges.find( (item:any) => item.id === node.id);
        // console.log('e：', edgeBusinessData);
        if(!edgeBusinessData){
            edgeBusinessData = {
                prop: {
                    actionName: '',
                    actionCode: '',
                    actionDesc: '',
                    priority: 1,
                    isCurrNodeAction: 0,
                },
                turnAround: {
                    method: [],
                    risk: []
                },
                // isCommonTurn: 0,
                // commonTurn: {
                //     "dictDeptCfgCategory": 0,
                //     "dictSpeCheckType": "1",
                //     "forRiskBusinessId": null,
                //     "riskBusinessName": "",
                //     "className": ""
                // },
                // isDirectTurn: 0,
                // directTurns: []            
            };
        }
        let textInfo = flowResource.value.nodes?.find( (item:any) => item.properties.associatedId === node.id);
        // console.log('textInfo：', textInfo );
        nodeData.value = {
            id: node.id,
            type: node.type,
            typeName: node.properties.customNodeTypeName,
            code: node.properties.customNodeCode,
            name: node.properties.customNodeName,
            position:{ x: node.startPoint.x, y: node.startPoint.y}, 
            associatedId: textInfo?textInfo.id:null,          
            businessData: {
                prop: edgeBusinessData.prop?edgeBusinessData.prop:{
                    actionName: '',
                    actionCode: '',
                    actionDesc: '',
                    priority: 0,
                    isCurrNodeAction: 0,
                },
                turnAround: edgeBusinessData.turnAround?edgeBusinessData.turnAround:{
                    method: [],
                    risk: []
                },
                // isCommonTurn: edgeBusinessData.isCommonTurn=='1'?true:false,
                // commonTurn: edgeBusinessData.commonTurn?{
                //     dictSpeCheckType: edgeBusinessData.commonTurn.dictSpeCheckType,
                //     forRiskBusinessId: edgeBusinessData.commonTurn.forRiskBusinessId,
                //     riskBusinessName: edgeBusinessData.commonTurn.riskBusinessName,
                //     className: edgeBusinessData.commonTurn.className,
                // }:{
                //     dictSpeCheckType:'1',
                //     forRiskBusinessId: null,
                //     riskBusinessName: null,
                //     className: '',
                // },
                // isDirectTurn: edgeBusinessData.isDirectTurn=='1'?true:false,
                // directTurns: edgeBusinessData.directTurns            
            }
        }
        // console.log('节点业务数据：',nodeData.value);
    }
        
    if(node.pointsList && node.pointsList.length>0){
       if(node.pointsList[0].x === node.pointsList[1].x ){
            nodeData.value.direction = node.pointsList[0].y > node.pointsList[1].y ? 'top' : 'bottom';
       }else{
            nodeData.value.direction = node.pointsList[0].x > node.pointsList[1].x ? 'left' : 'right';
       }
    }
    titleColor.value = node.properties.customNodeColor; 
    // 进入编辑状态 
    drawer.value = true;
}
defineExpose({
    editNode
})
</script>
<style scoped lang="scss">
:deep(.el-drawer__header) {
    padding: 20px 15px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 0;
    background-color: v-bind(titleColor);
}

.header-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 10px;
}

.system-set {
    font-size: 13px;
    margin: 20px 0 10px;
    display: flex;

    div {
        width: 230px;
        display: inline-grid;
        grid-gap: 10px;
        .hdTitle {
            font-size: 13px;
            margin-right: 15px;
            width: 28px;
            font-weight: 600;
        }
    }
}
</style>
